package com.example.demo.controller;

import com.example.demo.service.AqsDemoService;
import com.example.demo.service.DeductStockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * @author Code Farmer
 * @date 2020/4/23 11:53
 */
@RequestMapping("/")
@RestController
public class IndexController {

    @Autowired
    private DeductStockService deductStockService;
    @Autowired
    private AqsDemoService aqsDemoService;

    @RequestMapping({"/index", "/"})
    public String index() {
        return "hello world";
    }

    @GetMapping("/deduct_stock")
    public String deductStock() {
        return deductStockService.deductStock();
    }

    @GetMapping("/aqs/stock")
    public String aqsStock() {
        return aqsDemoService.decStockNoLock();
    }

    public static void main(String[] args) {
        System.out.println(UUID.randomUUID().toString().replaceAll("-", ""));
    }

}
